﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using mojoPortal.Web.Framework;
using Exchange.Business;

namespace liveatedu
{
    public partial class ExchangeLogin : System.Web.UI.Page
    {
        private hnt_ExchangeWebService exchange = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            exchange = new hnt_ExchangeWebService();
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = txtUser.Text.Trim();
            string password = txtPass.Text.Trim();

            bool success = false;
            success = exchange.IsLogin(userName, password);

            if (success)
            {
                string user = userName + "|" + password;
                CookieHelper.SetSecureCookie("UserOutlookMail", user);
                Response.Redirect("~/Default.aspx");
                //WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                lblError.Visible = false;
                //Response.Redirect("");
                //Session["Service"] = service;
                
            }
            else
            {
                lblError.Visible = true;

            }
        }


    }
}
